package org.nf.web.servlet.view;

import org.nf.web.servlet.BaseView;
import org.nf.web.servlet.ServletApi;

import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author wangl
 * @date 2021/10/14
 * HTML视图
 */
public class HtmlView extends BaseView {

    private final String html;

    public HtmlView(String html) {
        this.html = html;
    }

    @Override
    protected void render(ServletApi api) throws IOException {
        HttpServletResponse response = api.response();
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().println(html);
    }
}
